//**************************************************************************************************
//
// Camera.h: interface for the CCamera class.
//
// Description: basic 1st person camera
//
// Created by: Keith Ditchburn 15/11/2003
//
//**************************************************************************************************
#pragma once

#include "d3d9.h"
#include "d3dx9.h"

class CCamera  
{
public:
	void SetPosition(const D3DXVECTOR3 &pos);
	void SetView(const D3DXVECTOR3 &pos,const D3DXVECTOR3 &look);

	void RotateLeft();
	void RotateRight();
	void MouseMove(int dx,int dy);
	void MoveRight();
	void MoveLeft();
	void MoveBack();
	void MoveForward();
	void MoveDown();
	void MoveUp();
	void CalculateViewMatrix(D3DXMATRIX *view);
	inline const D3DXVECTOR3& CCamera::GetPosition() const {return m_position;}
	inline const D3DXVECTOR3& CCamera::GetLookDirection() const {return m_look;}

	CCamera();
	~CCamera();

private:
	void BaseRegenerateVectors();

	float m_movementSpeed;			// Speed of each movement
	float m_rotationSpeed;			// Speed of each rotation

	D3DXVECTOR3 m_position;			// Position of the camera in the world
	D3DXVECTOR3 m_look;				// Camera look direction
	D3DXVECTOR3 m_right;			// Vector pointing to the right
	D3DXVECTOR3 m_up;				// Which way is up
	D3DXVECTOR3 m_rotationChange;	// Holds required rotation changes temporarily
};
